package com.lession.controller;

import com.lession.Dto.AiReqDto;
import com.lession.common.LessionException;
import com.lession.common.Ret;
import com.lession.common.RetEnum;
import com.lession.config.aop.LogAspect;
import com.lession.service.AiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ai")
public class AiController {
	
	@Autowired
	private AiService aiService;
	
	@RequestMapping(value = "/one", method = RequestMethod.POST)
	public Ret TestOne(@RequestBody AiReqDto dto) {
		try {
			return Ret.ok().data(aiService.aiOne(dto)).build();
		} catch (LessionException e) {
			return Ret.error(e.getCode()).msg(e.getMessage()).build();
		} catch (Exception e) {
			return Ret.error(RetEnum.INTERFACE_CALL_FAIL_ERROR.getCode()).build();
		}
		
	}
}
